package com.yulang.common.pojo.goods;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 商品表
 * </p>
 *
 * @author Administrator
 * @since 2019-12-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_sku")
public class Sku implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 商品id
     */
    @TableId(value = ID, type = IdType.INPUT)
    private String id;

    /**
     * 商品条码
     */
    @TableField(SN)
    private String sn;

    /**
     * SKU名称
     */
    @TableField(NAME)
    private String name;

    /**
     * 价格（分）
     */
    @TableField(PRICE)
    private Integer price;

    /**
     * 库存数量
     */
    @TableField(NUM)
    private Integer num;

    /**
     * 库存预警数量
     */
    @TableField(ALERT_NUM)
    private Integer alertNum;

    /**
     * 商品图片
     */
    @TableField(IMAGE)
    private String image;

    /**
     * 商品图片列表
     */
    @TableField(IMAGES)
    private String images;

    /**
     * 重量（克）
     */
    @TableField(WEIGHT)
    private Integer weight;

    /**
     * 创建时间
     */
    @TableField(CREATE_TIME)
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(UPDATE_TIME)
    private Date updateTime;

    /**
     * SPUID
     */
    @TableField(SPU_ID)
    private String spuId;

    /**
     * 类目ID
     */
    @TableField(CATEGORY_ID)
    private Integer categoryId;

    /**
     * 类目名称
     */
    @TableField(CATEGORY_NAME)
    private String categoryName;

    /**
     * 品牌名称
     */
    @TableField(BRAND_NAME)
    private String brandName;

    /**
     * 规格
     */
    @TableField(SPEC)
    private String spec;

    /**
     * 销量
     */
    @TableField(SALE_NUM)
    private Integer saleNum;

    /**
     * 评论数
     */
    @TableField(COMMENT_NUM)
    private Integer commentNum;

    /**
     * 商品状态 1-正常，2-下架，3-删除
     */
    @TableField(STATUS)
    private String status;


    public static final String ID = "`id`";

    public static final String SN = "`sn`";

    public static final String NAME = "`name`";

    public static final String PRICE = "`price`";

    public static final String NUM = "`num`";

    public static final String ALERT_NUM = "`alert_num`";

    public static final String IMAGE = "`image`";

    public static final String IMAGES = "`images`";

    public static final String WEIGHT = "`weight`";

    public static final String CREATE_TIME = "`create_time`";

    public static final String UPDATE_TIME = "`update_time`";

    public static final String SPU_ID = "`spu_id`";

    public static final String CATEGORY_ID = "`category_id`";

    public static final String CATEGORY_NAME = "`category_name`";

    public static final String BRAND_NAME = "`brand_name`";

    public static final String SPEC = "`spec`";

    public static final String SALE_NUM = "`sale_num`";

    public static final String COMMENT_NUM = "`comment_num`";

    public static final String STATUS = "`status`";


    public static final String ID_COMMENT = "商品id";

    public static final String SN_COMMENT = "商品条码";

    public static final String NAME_COMMENT = "SKU名称";

    public static final String PRICE_COMMENT = "价格（分）";

    public static final String NUM_COMMENT = "库存数量";

    public static final String ALERT_NUM_COMMENT = "库存预警数量";

    public static final String IMAGE_COMMENT = "商品图片";

    public static final String IMAGES_COMMENT = "商品图片列表";

    public static final String WEIGHT_COMMENT = "重量（克）";

    public static final String CREATE_TIME_COMMENT = "创建时间";

    public static final String UPDATE_TIME_COMMENT = "更新时间";

    public static final String SPU_ID_COMMENT = "SPUID";

    public static final String CATEGORY_ID_COMMENT = "类目ID";

    public static final String CATEGORY_NAME_COMMENT = "类目名称";

    public static final String BRAND_NAME_COMMENT = "品牌名称";

    public static final String SPEC_COMMENT = "规格";

    public static final String SALE_NUM_COMMENT = "销量";

    public static final String COMMENT_NUM_COMMENT = "评论数";

    public static final String STATUS_COMMENT = "商品状态 1-正常，2-下架，3-删除";



    public static Sku of(Object obj) {
        Sku e = new Sku();
        BeanUtils.copyProperties(obj, e);
        return e;
    }

    public static QueryWrapper<Sku> queryWrapper(Object obj) {
        return new QueryWrapper<>(of(obj));
    }

}
